<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('设备问题报备列表')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li class="select-time"><label>日期：</label> <input
								type="text" class="time-input" id="startTime" placeholder="开始时间"
								name="params[beginTime]" /> <span>
								<!-- -</span> <input
								type="text" class="time-input" id="endTime" placeholder="结束时间"
								name="params[endTime]" /></li> -->
								
								
							<li><label>设备名称：</label> <input type="text" name="name" /></li>
							<li><label>报备人：</label> 
							 <select name="report" class="form-control">
		                        <option value="">无</option>
		                        <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userName}"></option>
		                    </select>
							
							</li>
							<li><label>维修人：</label> 
										<select name="repair" class="form-control">
					                        <option value="">无</option>
					                        <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userName}"></option>
					                    </select>
							</li>
							<li><label>操作人员：</label> 
										<select name="createBy" class="form-control">
					                        <option value="">无</option>
					                        <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userName}"></option>
					                    </select>
							</li>
						</ul>
						</div>
						<div class="select-list">
						<ul>
						
							<li><label>待处理：</label> <input type="text" name="dealing" />
							</li>
							<li><a class="btn btn-primary btn-rounded btn-sm"
								onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm"
								onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addFull()"
					shiro:hasPermission="system:question:add"> <i
					class="fa fa-plus"></i> 添加
				</a> <a class="btn btn-primary single disabled"
					onclick="$.operate.editFull()"
					shiro:hasPermission="system:question:edit"> <i
					class="fa fa-edit"></i> 修改
				</a> <a class="btn btn-danger multiple disabled"
					onclick="$.operate.removeAll()"
					shiro:hasPermission="system:question:remove"> <i
					class="fa fa-remove"></i> 删除
				</a>
				<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:question:export">
                    <i class="fa fa-download"></i> 导出
                </a> -->
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:question:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:question:remove')}]];
        var prefix = ctx + "system/question";

        $(function() {
        	
        	function dateFormat(fmt, date) {
        	    let ret;
        	    const opt = {
        	        "Y+": date.getFullYear().toString(),        // 年
        	        "m+": (date.getMonth() + 1).toString(),     // 月
        	        "d+": date.getDate().toString(),            // 日
        	        "H+": date.getHours().toString(),           // 时
        	        "M+": date.getMinutes().toString(),         // 分
        	        "S+": date.getSeconds().toString()          // 秒
        	        // 有其他格式化字符需求可以继续添加，必须转化成字符串
        	    };
        	    for (let k in opt) {
        	        ret = new RegExp("(" + k + ")").exec(fmt);
        	        if (ret) {
        	            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
        	        };
        	    };
        	    return fmt;
        	}
        	
        	
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
               // exportUrl: prefix + "/export",
                modalName: "设备问题报备",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false,
                    hidden: true
                },
                {
                	title: "序号",
                	formatter: function (value, row, index) {
                		return $.table.serialNumber(index);
                	}
                },
                {
                    field: 'createTime',
                    title: '日期',
                    formatter:function (value, row, index) {
                		return value.substring(0,10);
                	}
                },
                {
                    field: 'name',
                    title: '设备名称'
                },
             /*    {
                    field: 'question',
                    title: '问题描述'
                }, */
                {
                    field: 'require',
                    title: '要求'
                },
                {
                    field: 'report',
                    title: '报备人'
                },
             /*    {
                    field: 'dealSay',
                    title: '处理情况说明'
                }, */
                {
                    field: 'repair',
                    title: '维修人'
                },
                {
                    field: 'repairTime',
                    title: '维修时间',
                    formatter:function (value, row, index) {
                		return value != null ?value.substring(0,10):"";
                	}
                },
                {
                    field: 'dealing',
                    title: '待处理'
                },
                {
                    field: 'dealingSay',
                    title: '待处理说明'
                },
                {
                    field: 'createBy',
                    title: '操作人员'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="pp(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function pp(id){
        	   var url = '/system/question/editN/' + id;
        	   
        		 var btn = ['<i class="fa fa-close"></i> 关闭'];
        			var options = {
        					title: '设备问题详情',
        					width: "800",
        					height: "500",
        					url: url,
        					btn: btn,
        					callBack: doSubmit
        				};
        	$.modal.openOptions(options);
              // $.modal.open("设备问题详情", url)
        }
        function doSubmit(index, layero){
    		layer.close(index);
   		 }
        
    </script>
</body>
</html>